<?php

/*

Trivia (trivia_play.pro.php)

*/
ob_start();
$page_title = "Trivia";
$rank_check = 1;
include "header.inc.php";

print "$openHTML";

$get_game = fetch("SELECT * FROM trivia_games WHERE id = '$trivia_game' AND game = '$game'");

$get_question = fetch("SELECT * FROM trivia_questions WHERE trivia_game = '$trivia_game' AND game = '$game' AND id = '$question'");

if ($get_question[answer] == $answer)
{
	echo "<p>That is correct. You win $get_game[prize] $pointsVar. Would you like to <a href=trivia_play.php?game=$game&trivia_game=$trivia_game>play again</a>?</p>";
	points($game,$username,$get_game[prize]);
}
if ($get_question[answer] != $answer)
{
	echo "<p>I'm sorry, that is incorrect. Would you like to <a href=trivia_play.php?game=$game&trivia_game=$trivia_game>play again</a>?</p>";
}

points($game,$username,"-$get_game[price]");

mysql_query("UPDATE trivia_records SET last_question = '$get_question[id]' WHERE userid = '$userid' AND trivia_game = '$trivia_game' AND game = '$game'");

print "$closeHTML";

?>